home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-10-28 | 12.6 KB | 305 lines |
- package com.symantec.itools.swing;
-
- import java.beans.*;
- import java.util.ResourceBundle;
- import com.symantec.itools.swing.DesignTimeResourceBundle;
- import com.symantec.itools.swing.beans.BeanDescriptorAttributes;
- import com.symantec.itools.beans.*;
- import com.symantec.itools.beans.HelperBeanInfo;
- import com.symantec.itools.vcafe.beans.*;
- import com.symantec.itools.vcafe.beans.ActionDescriptor;
- import com.symantec.itools.vcafe.beans.MethodDescriptorAttributes;
-
- public final class JChartBeanInfo
- extends com.symantec.itools.beans.HelperBeanInfo
- {
- public JChartBeanInfo()
- {
- setInheritSuperBeanInfo(true);
-
- ResourceBundle resources = ResourceBundle.getBundle("com.symantec.itools.swing.DesignTimeResourceBundle");
- String folderName = resources.getString(DesignTimeResourceBundle.SWING_ADDITIONS_FOLDER_TOOLBAR_KEY);
- setComponentLibraryFolder(folderName);
- setToolbarFolder(folderName);
-
- setWinHelpKey(m_WinHelpID);
- setIsContainer( false );
-
- set16x16ColorIconName("JChart.gif");
- }
-
- protected Class getBeanClass()
- {
- return JChart.class;
- }
-
- public PropertyDescriptor[] getPropertyDescriptors()
- {
- try
- {
- final Class beanClass = getBeanClass();
-
- PropertyDescriptor model = new PropertyDescriptor("model", beanClass);
- model.setValue(PropertyDescriptorAttributes.WIN_HELP_ATTRIBUTE, new Integer(PropertyHelpIDs.JCHART_MODEL_HELP_ID));
-
- PropertyDescriptor graphStylePD = new PropertyDescriptor("style", beanClass);
- graphStylePD.setPropertyEditorClass(GraphStylePropertyEditor.class);
- graphStylePD.setValue(PropertyDescriptorAttributes.WIN_HELP_ATTRIBUTE, new Integer(PropertyHelpIDs.JCHART_STYLE_HELP_ID));
-
- PropertyDescriptor showLegend = new PropertyDescriptor("showLegend", beanClass);
- showLegend.setValue(PropertyDescriptorAttributes.WIN_HELP_ATTRIBUTE, new Integer(PropertyHelpIDs.JCHART_SHOW_LEGEND_HELP_ID));
-
- PropertyDescriptor showGrid = new PropertyDescriptor("showGrid", beanClass);
- showGrid.setValue(PropertyDescriptorAttributes.WIN_HELP_ATTRIBUTE, new Integer(PropertyHelpIDs.JCHART_SHOW_GRID_HELP_ID));
-
- PropertyDescriptor title = new PropertyDescriptor("title", beanClass);
- title.setValue(PropertyDescriptorAttributes.WIN_HELP_ATTRIBUTE, new Integer(PropertyHelpIDs.JCHART_TITLE_HELP_ID));
-
- PropertyDescriptor precision = new PropertyDescriptor("precision", beanClass );
- precision.setValue(PropertyDescriptorAttributes.WIN_HELP_ATTRIBUTE, new Integer(PropertyHelpIDs.JCHART_PRECISION_HELP_ID));
-
- PropertyDescriptor numYTicks = new PropertyDescriptor("numYTicks", beanClass);
- numYTicks.setValue(PropertyDescriptorAttributes.WIN_HELP_ATTRIBUTE, new Integer(PropertyHelpIDs.JCHART_NUM_YTICKS_HELP_ID));
-
- PropertyDescriptor yAxisMin = new PropertyDescriptor("yAxisMin", beanClass);
- yAxisMin.setValue(PropertyDescriptorAttributes.WIN_HELP_ATTRIBUTE, new Integer(PropertyHelpIDs.JCHART_YAXIS_MIN_HELP_ID));
-
- PropertyDescriptor yAxisMax = new PropertyDescriptor("yAxisMax", beanClass);
- yAxisMax.setValue(PropertyDescriptorAttributes.WIN_HELP_ATTRIBUTE, new Integer(PropertyHelpIDs.JCHART_YAXIS_MAX_HELP_ID));
-
- PropertyDescriptor[] rv = {
- model,
- graphStylePD,
- showLegend,
- showGrid,
- title,
- precision,
- numYTicks,
- yAxisMin,
- yAxisMax };
-
- return rv;
- }
- catch(IntrospectionException e)
- {
- e.printStackTrace();
- }
-
- //Error, return no properties
- return new PropertyDescriptor[0];
- }
-
- /**
- * Gets an array of descriptions of the methods used for "connections" by
- * Visual CafΘs Interaction Wizard.
- * Included in each method description is a CONNECTIONS ActionDescriptor.
- * @return method descriptions for this bean
- * @see com.symantec.itools.vcafe.beans.ActionDescriptor
- */
-
- public MethodDescriptor[] getMethodDescriptors() {
- Class[] args;
- ActionDescriptor connection;
- java.util.Vector connections;
- java.util.Vector md = new java.util.Vector();
- ResourceBundle conn = ResourceBundle.getBundle("com.symantec.itools.swing.JChartResourceBundle");
-
- try{
- args = null;
- MethodDescriptor getModel = new MethodDescriptor(beanClass.getMethod("getModel", args));
-
- connections = new java.util.Vector();
- connection = new ActionDescriptor("output", "TableModel", "",
- "%name%.getModel()",
- conn.getString(JChartResourceBundle.JCHART_GET_MODEL_CONNNECTION_KEY));
- connections.addElement(connection);
-
- getModel.setValue(MethodDescriptorAttributes.ACTION_ATTRIBUTE, connections);
- md.addElement(getModel);
- } catch (Exception e) { throw new Error("getModel:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = com.sun.java.swing.table.TableModel.class ;
- MethodDescriptor setModel = new MethodDescriptor(beanClass.getMethod("setModel", args));
-
- connections = new java.util.Vector();
- connection = new ActionDescriptor("input", "TableModel", "",
- "%name%.setModel(%arg%);",
- conn.getString(JChartResourceBundle.JCHART_SET_MODEL_CONNNECTION_KEY));
- connections.addElement(connection);
-
- setModel.setValue(MethodDescriptorAttributes.ACTION_ATTRIBUTE, connections);
- md.addElement(setModel);
- } catch (Exception e) { throw new Error("setModel:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Integer.TYPE;
- MethodDescriptor setStyle = new MethodDescriptor(beanClass.getMethod("setStyle", args));
-
- connections = new java.util.Vector();
- connection = new ActionDescriptor("input", "int", "",
- "%name%.setStyle(%arg%);",
- conn.getString(JChartResourceBundle.JCHART_SET_STYLE_CONNNECTION_KEY));
- connections.addElement(connection);
-
- setStyle.setValue(MethodDescriptorAttributes.ACTION_ATTRIBUTE, connections);
- md.addElement(setStyle);
- } catch (Exception e) { throw new Error("setStyle:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getStyle = new MethodDescriptor(beanClass.getMethod("getStyle", args));
-
- connections = new java.util.Vector();
- connection = new ActionDescriptor("output", "int", "",
- "%name%.getStyle()",
- conn.getString(JChartResourceBundle.JCHART_GET_STYLE_CONNNECTION_KEY));
- connections.addElement(connection);
-
- getStyle.setValue(MethodDescriptorAttributes.ACTION_ATTRIBUTE, connections);
- md.addElement(getStyle);
- } catch (Exception e) { throw new Error("getStyle:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.String.class;
- //args[0] = java.lang.Boolean.TYPE;
- MethodDescriptor setTitle = new MethodDescriptor(beanClass.getMethod("setTitle", args));
-
- connections = new java.util.Vector();
- connection = new ActionDescriptor("input", "String", "",
- "%name%.setTitle(%arg%);",
- conn.getString(JChartResourceBundle.JCHART_SET_TITLE_CONNNECTION_KEY));
- connections.addElement(connection);
-
- setTitle.setValue(MethodDescriptorAttributes.ACTION_ATTRIBUTE, connections);
- md.addElement(setTitle);
- } catch (Exception e) { throw new Error("setTitle:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getTitle = new MethodDescriptor(beanClass.getMethod("getTitle", args));
-
- connections = new java.util.Vector();
- connection = new ActionDescriptor("output", "String", "",
- "%name%.getTitle()",
- conn.getString(JChartResourceBundle.JCHART_GET_TITLE_CONNNECTION_KEY));
- connections.addElement(connection);
-
- getTitle.setValue(MethodDescriptorAttributes.ACTION_ATTRIBUTE, connections);
- md.addElement(getTitle);
- } catch (Exception e) { throw new Error("getTitle:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Integer.TYPE;
- MethodDescriptor setNumYTicks = new MethodDescriptor(beanClass.getMethod("setNumYTicks", args));
-
- connections = new java.util.Vector();
- connection = new ActionDescriptor("input", "int", "",
- "%name%.setNumYTicks(%arg%);",
- conn.getString(JChartResourceBundle.JCHART_SET_NUMYTICKS_CONNNECTION_KEY));
- connections.addElement(connection);
-
- setNumYTicks.setValue(MethodDescriptorAttributes.ACTION_ATTRIBUTE, connections);
- md.addElement(setNumYTicks);
- } catch (Exception e) { throw new Error("setNumYTicks:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getNumYTicks = new MethodDescriptor(beanClass.getMethod("getNumYTicks", args));
-
- connections = new java.util.Vector();
- connection = new ActionDescriptor("output", "int", "",
- "%name%.getNumYTicks()",
- conn.getString(JChartResourceBundle.JCHART_GET_NUMYTICKS_CONNNECTION_KEY));
- connections.addElement(connection);
-
- getNumYTicks.setValue(MethodDescriptorAttributes.ACTION_ATTRIBUTE, connections);
- md.addElement(getNumYTicks);
- } catch (Exception e) { throw new Error("getNumYTicks:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getNumSeries = new MethodDescriptor(beanClass.getMethod("getNumSeries", args));
-
- connections = new java.util.Vector();
- connection = new ActionDescriptor("output", "int", "",
- "%name%.getNumSeries()",
- conn.getString(JChartResourceBundle.JCHART_GET_NUMSERIES_CONNNECTION_KEY));
- connections.addElement(connection);
-
- getNumSeries.setValue(MethodDescriptorAttributes.ACTION_ATTRIBUTE, connections);
- md.addElement(getNumSeries);
- } catch (Exception e) { throw new Error("getNumSeries:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Double.TYPE;
- MethodDescriptor setYAxisMin = new MethodDescriptor(beanClass.getMethod("setYAxisMin", args));
-
- connections = new java.util.Vector();
- connection = new ActionDescriptor("input", "double", "",
- "%name%.setYAxisMin(%arg%);",
- conn.getString(JChartResourceBundle.JCHART_SET_YAXISMIN_CONNNECTION_KEY));
- connections.addElement(connection);
-
- setYAxisMin.setValue(MethodDescriptorAttributes.ACTION_ATTRIBUTE, connections);
- md.addElement(setYAxisMin);
- } catch (Exception e) { throw new Error("setYAxisMin:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getYAxisMin = new MethodDescriptor(beanClass.getMethod("getYAxisMin", args));
-
- connections = new java.util.Vector();
- connection = new ActionDescriptor("output", "double", "",
- "%name%.getYAxisMin()",
- conn.getString(JChartResourceBundle.JCHART_GET_YAXISMIN_CONNNECTION_KEY));
- connections.addElement(connection);
-
- getYAxisMin.setValue(MethodDescriptorAttributes.ACTION_ATTRIBUTE, connections);
- md.addElement(getYAxisMin);
- } catch (Exception e) { throw new Error("getYAxisMin:: " + e.toString()); }
-
- try{
- args = new Class[1];
- args[0] = java.lang.Double.TYPE;
- MethodDescriptor setYAxisMax = new MethodDescriptor(beanClass.getMethod("setYAxisMax", args));
-
- connections = new java.util.Vector();
- connection = new ActionDescriptor("input", "double", "",
- "%name%.setYAxisMax(%arg%);",
- conn.getString(JChartResourceBundle.JCHART_SET_YAXISMAX_CONNNECTION_KEY));
- connections.addElement(connection);
-
- setYAxisMax.setValue(MethodDescriptorAttributes.ACTION_ATTRIBUTE, connections);
- md.addElement(setYAxisMax);
- } catch (Exception e) { throw new Error("setYAxisMax:: " + e.toString()); }
-
- try{
- args = null;
- MethodDescriptor getYAxisMax = new MethodDescriptor(beanClass.getMethod("getYAxisMax", args));
-
- connections = new java.util.Vector();
- connection = new ActionDescriptor("output", "double", "",
- "%name%.getYAxisMax()",
- conn.getString(JChartResourceBundle.JCHART_GET_YAXISMAX_CONNNECTION_KEY));
- connections.addElement(connection);
-
- getYAxisMax.setValue(MethodDescriptorAttributes.ACTION_ATTRIBUTE, connections);
- md.addElement(getYAxisMax);
- } catch (Exception e) { throw new Error("getYAxisMax:: " + e.toString()); }
-
- MethodDescriptor[] rv = new MethodDescriptor[md.size()];
- md.copyInto(rv);
-
- return rv;
- }
-
- protected final static Class beanClass = JChart.class;
- protected final static String m_WinHelpID = "0x6013D";
- }
-